<?php
/**
 * Created by PhpStorm.
 * User: hemingguang
 * Date: 2015/7/28
 * Time: 18:01
 */

class openapi_api_params_v1_register extends openapi_api_params_abstract implements openapi_api_params_interface{

    public function checkParams($method,$params,&$sub_msg,$defined_params=array(),$dataType='kv'){
        if(parent::checkParams($method,$params,$sub_msg,$defined_params,$dataType)){
            return true;
        }else{
            return false;
        }
    }

    function description($method){
        $description = array(
            'protocol' => array(
                'name' => '获取用户协议接口',
                'description' => '返回success表示成功，返回error表示错误',
            ),
            'regist' => array(
                'name' => '提交注册表单',
                'description' => '返回success表示成功，返回error表示错误',
            ),
            'store' => array(
                'name' => '选择经销商角色',
                'description' => '选择经销商角色',
            ),
            'busscope' => array(
                'name' => '层级经营范围',
                'description' => '获取层级可经营范围',
            ),
            'scope_save' => array(
                'name' => '保存层级信息',
                'description' => '保存层级信息接口',
            ),
            'store_save' => array(
                'name' => '提交经销商信息',
                'description' => '提交经销商信息接口',
            ),
            'getjoinqualify' => array(
                'name' => '获取经销商审核项接口',
                'description' => '获取经销商审核项接口',
            ),
            'joinqualify' => array(
                'name' => '提交经销商审核项接口',
                'description' => '提交经销商审核项接口',
            ),
        );
        return $description[$method];
    }

    function getAppParams($method){
        $params = array(
            'regist' => array(
                'reg_type' => array('required'=>'false','default'=>'email','type'=>'string','name'=>'注册类型'),
                'login_name' => array('required'=>'false','type'=>'string','name'=>'用户名'),
                'login_password'  => array('required'=>'true','type'=>'string','name'=>'密码'),
                'psw_confirm'  => array('required'=>'true','type'=>'string','name'=>'确认密码'),
                'email' => array('required'=>'false','type'=>'string','name'=>'邮箱'),
                'mobile' => array('required'=>'false','type'=>'string','name'=>'手机号'),
            ),
            'store' => array(
                'login_token' => array('required'=>'true','type'=>'string','name'=>'登陆token'),
                'member_id' => array('required'=>'false','type'=>'string','name'=>'用户ID'),
            ),
            'busscope'=>array(
                'login_token' => array('required'=>'false','type'=>'string','name'=>'登陆token'),
                'grade_id' => array('required'=>'true','type'=>'string','name'=>'层级ID'),
                'area'=>array('required'=>'true','type'=>'string','name'=>'区域信息'),
                'addr'=>array('required'=>'true','type'=>'string','name'=>'详细地址信息'),
            ),
            'scope_save'=>array(
                'login_token' => array('required'=>'true','type'=>'string','name'=>'登录token'),
                'area' => array('required'=>'true','type'=>'string','name'=>'区域信息'),
                'addr' => array('required'=>'true','type'=>'string','name'=>'地址信息'),
                'store_grade' => array('required'=>'true','type'=>'int','name'=>'入驻层级'),
                'store_region' => array('required'=>'true','type'=>'string','name'=>'经营范围'),
            ),
            'store_save'=>array(
                'login_token' => array('required'=>'true','type'=>'string','name'=>'登陆token'),
                'store_idcardname' => array('required'=>'true','type'=>'string','name'=>'店主实名'),
                'store_name' => array('required'=>'true','type'=>'string','name'=>'经销商名称'),
                'parent_id' => array('required'=>'false','type'=>'string','name'=>'父级经销商ID'),
                'bank_name' => array('required'=>'false','type'=>'string','name'=>'银行名称'),
                'bank_cardid' => array('required'=>'false','type'=>'string','name'=>'银行卡号'),
                'pay_password' => array('required'=>'true','type'=>'string','name'=>'支付密码'),
                'confirm_pay_password' => array('required'=>'true','type'=>'string','name'=>'确认支付密码'),
            ),
            'protocol' => array(
                'login_token' => array('required'=>'false','type'=>'string','name'=>'登陆token'),
            ),
            'getjoinqualify' => array(
                'login_token' => array('required'=>'true','type'=>'string','name'=>'登陆token'),
            ),
            'joinqualify' => array(
                'login_token' => array('required'=>'true','type'=>'string','name'=>'登陆token'),
                'store_id'=>array('required'=>'true','type'=>'number','name'=>'经销商ID'),
                'qualify'=>array('required'=>'true','type'=>'json','name'=>'待审核信息',
                    'items'=>array(
                        'item_name'=>array('required'=>'true','type'=>'string','name'=>'审核项名称'),
                        'item_value'=>array('required'=>'true','type'=>'string','name'=>'审核项值'),
                    ),
                ),
            ),
        );
        return $params[$method];
    }

}